home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / c-tools-.000 / c-tools- / c-tools-0.4 / hash.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-13  |  841 b   |  34 lines

  1. /* $Id: hash.h,v 1.2 1995/08/06 18:23:23 sandro Exp $ */
  2.  
  3. #ifndef __HASH_H
  4. #define __HASH_H
  5.  
  6. #define HASH_TABLE_SIZE        127
  7.  
  8. #define HASH_OK            0
  9. #define HASH_INVALID_PARAMETER    -1
  10. #define HASH_NOT_FOUND        -2
  11. #define HASH_ALREADY_EXIST    -3
  12.  
  13. struct bucket {
  14.     char *key;
  15.     void *data;
  16.     struct bucket *next;
  17. };
  18.  
  19. struct hash_table {
  20.     struct bucket *table[HASH_TABLE_SIZE];
  21. };
  22.  
  23. extern struct hash_table *hash_table_build (void);
  24. extern int hash_table_free (struct hash_table *);
  25. extern int hash_table_add (struct hash_table *, char *);
  26. extern int hash_table_lookup (struct hash_table *, char *);
  27. extern int hash_table_remove (struct hash_table *, char *);
  28. extern int hash_table_set_data (struct hash_table *, char *, void *);
  29. extern void *hash_table_retrive_data (struct hash_table *, char *);
  30.  
  31. #endif /* __HASH_H */
  32.  
  33. /* hash.h ends here */
  34.